<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="sec"
	uri="http://www.springframework.org/security/tags"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<jsp:include page="./main.jsp" />

</head>
<body ng-app="myApp" class="body" >
	<!-- modal template -->
	<script type="text/ng-template" id="myModelContent.html">
       <div class="modal-header">
              <h3 class="modal-title">创建用户</h3>
          </div>
          <div class="modal-body">
             <form name="creatForm" class="form-validation ng-pristine ng-valid-email ng-invalid ng-invalid-required">
						<div class="list-group list-group-sm">
							<div class="list-group-item">
								<input placeholder="Email" name="creatEmail" class="form-control no-border ng-pristine ng-valid-email ng-invalid ng-invalid-required ng-touched"
									ng-model="creatUser.email" required type="email">
							</div>
							<div class="list-group-item">
								<input placeholder="Password" name="creatPassword"
									class="form-control no-border ng-pristine ng-invalid ng-invalid-required ng-touched"
									ng-model="creatUser.password" required type="password">
							</div>
						</div>
					</form>
       </div>
        <div class="modal-footer">
		<button type="submit" ng-click="ok()" class="btn btn-primary"
							ng-disabled="creatForm.creatEmail.$invalid || creatForm.creatPassword.$invalid">确认</button>
             <button class="btn btn-warning" ng-click="cancel()">退出</button>
       </div>
    </script>



	<!-- load js -->


	<script
		src="http://cdn.bootcss.com/angular-ui-bootstrap/0.11.2/ui-bootstrap-tpls.js"></script>
	<div class="app ng-scope app-header-fixed app-aside-fixed" id="app"
		ng-class="{'app-header-fixed':app.settings.headerFixed, 'app-aside-fixed':app.settings.asideFixed, 'app-aside-folded':app.settings.asideFolded, 'app-aside-dock':app.settings.asideDock, 'container':app.settings.container}"
		ui-view="" ng-controller="modalDemo">
		<!-- uiView:  -->
		<div ui-view="" class="fade-in-right-big smooth ng-scope">
			<div class="container w-xxl w-auto-xs ng-scope text-center">
				<a href="" class="navbar-brand block m-t ng-binding">Login</a>
				<div class="m-b-lg">
					<div class="wrapper text-center">
						<strong>Sign in to get in touch</strong>
					</div>
					<form name="form"
						class="form-validation  ng-valid-email ng-invalid ng-invalid-required"
						action="/login" method="post">
						<div class="list-group list-group-sm">
							<div class="list-group-item">
								<input placeholder="Email" name="username"
									class="form-control no-border ng-pristine ng-valid-email ng-invalid ng-invalid-required ng-touched"
									ng-model="user.email" required type="email">
							</div>
							<div class="list-group-item">
								<input placeholder="Password" name="password"
									class="form-control no-border ng-pristine ng-invalid ng-invalid-required ng-touched"
									ng-model="user.password" required type="password">
							</div>
						</div>
						<button type="submit" class="btn btn-lg btn-primary btn-block"
							ng-disabled="form.username.$invalid || form.password.$invalid">Log
							in</button>
						<div class="text-center m-t m-b">
							<a ui-sref="access.forgotpwd" href="javascript:alert('未开通！')">Forgot
								password?</a>
						</div>
					</form>
					<button class="btn btn-lg btn-default btn-block" ng-click="open()">Create an account</button>
				</div>
			</div>
		</div>
	</div>


	<script>
	
	angular.module('myApp', [ 'ui.bootstrap' ]).controller('modalDemo', function($scope, $modal, $log) { // list
		$scope.items = [ 'angularjs', 'backbone', 'canjs', 'Ember', 'react' ];

		// open click
		 $scope.open = function(size) { 
			var modalInstance = $modal.open({ templateUrl : 'myModelContent.html', 
				controller :'ModalInstanceCtrl',  
				size : size,
		       resolve : { items : function() { 
						    	   			return $scope.items; 
						    	   			} 
						} 
			}); 
		 modalInstance.result.then(function(messageItem) {
											$scope.user = messageItem; 
											}, function() {
												$log.info('Modal dismissed at: ' + new Date()) }); } })
												//模态窗口控制
												.controller('ModalInstanceCtrl', function($scope, $modalInstance,$http) { 
		
		// ok click 
		$scope.ok = function() {
		$http.post("permit/creatUser",$scope.creatUser).then(function(result){
			alert(result.data.success);
			$modalInstance.close($scope.creatUser); 
		},function(error){
			alert("error");
		})
		
		}; 
		// cancel click
		$scope.cancel = function() { 
			$modalInstance.dismiss('cancel');
			} 
		});
	
	</script>

</body>

</html>